<?php
// +----------------------------------------------------------------------
// | Author: 黄泽宏 <2623213969@qq.com>
// +----------------------------------------------------------------------

namespace app\home\controller;
/**
 * 前台首页控制器
 * 主要获取首页聚合数据
 */
class IndexController extends HomeController {

    /**
     * 封面
     */
    public function index(){
        $bannerList = db('Ad')->where(['position_id'=>2])->order('id desc')->select();
        $hotGoods = db('Goods')->where(['is_on_sale'=>1,'is_hot'=>1])->select();
        $recommendGoods = db('Goods')->where(['is_on_sale'=>1])->select();
        $category = db('GoodsCategory')->limit(2)->select();
        $articleList = db('Article')->where(['cate_id'=>14])->order('sort asc,id desc')->select();
        $this->assign([
            'bannerList' => $bannerList,
            'hotGoods' => $hotGoods,
            'category' => $category,
            'recommendGoods' => $recommendGoods,
            'articleList' => $articleList,
        ]);
        return $this->fetch('index');
    }


}